<?php
class Core_Block_Template extends Core_Block_Abstract {

	protected function _toHtml() {
		if (!$this->getTemplate()) return '';
		$html = $this->_fetchView($this->getTemplate() . '.php');
		return $html;
	}

	protected function _fetchView($template) {
		$theme = Mag::getController()->getArea()->getCurrentTheme();
		$filename = $theme->getTemplateFilename($template);
		if (!is_readable($filename)) return '';

        try {
			ob_start();
			include $filename;
        } catch (Exception $e) {
            ob_get_clean();
            throw $e;
        }
		$html = ob_get_clean();
		return $html;
	}
}